﻿// CAddListNameDlg.cpp: 实现文件
//

#include "pch.h"
#include "RandomRollCall.h"
#include "CAddListNameDlg.h"
#include "afxdialogex.h"


// CAddListNameDlg 对话框

IMPLEMENT_DYNAMIC(CAddListNameDlg, CDialogEx)

CAddListNameDlg::CAddListNameDlg(CWnd* pParent /*=nullptr*/)
	: CDialogEx(IDD_DIALOG3, pParent)
{

}

CAddListNameDlg::~CAddListNameDlg()
{
}

void CAddListNameDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialogEx::DoDataExchange(pDX);
	DDX_Control(pDX, IDC_EDIT1, m_EditName);
	DDX_Control(pDX, IDC_EDIT2, m_EditNo_);
}


BEGIN_MESSAGE_MAP(CAddListNameDlg, CDialogEx)
	ON_BN_CLICKED(IDOK, &CAddListNameDlg::OnBnClickedOk)
END_MESSAGE_MAP()


// CAddListNameDlg 消息处理程序


void CAddListNameDlg::OnBnClickedOk()
{
	// TODO: 在此添加控件通知处理程序代码
	Manager::CallListManger calllist;
	CString path = Manager::ProgramPath::Path();
	calllist.ReadFileByPath(path);
	Manager::CallListData data;
	UpdateData(TRUE);
	m_EditName.GetWindowTextW(data.name);
	m_EditNo_.GetWindowTextW(data.no_);
	UpdateData(FALSE);
	calllist.list.Add(data);
	calllist.WriteFileByPath(path);
	CDialogEx::OnOK();
}
